
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    num: 1
  },
  getters: {

  },
  mutations: {
    add(state) {
      state.num++
    },
    reduce(state) {
      state.num--
    }
  },
  actions: {
    adds(context) {
      setTimeout(() => {
        context.commit('add')
      }, 2000);
    },
    reduces(context) {
      setTimeout(() => {
        context.commit('reduce')
      }, 2000);
    }
  },
  modules: {}
})